package GameLogic;

public class ProjectileArrow extends EntityProjectile{
	
		double targetX;
		double targetY;
		double mod;
		double modx;
		
	public ProjectileArrow(EntityCoordinate target)
		{
			
			damage = 5;
			isEnemy = true;
			isProjectile = true;
			model = new EntityModel();
			model.texture_path = "res/plasma.png";
			model.frames=1;                            //model does not have any frames
	        model.texture_coordinates=new float[] {0.0f, 0.0f,      //quad vertices; NOTICE: if you start with 0 as bottom left vertex
	                                     0.0f, 1.0f,       // it will spin around this vertex (rotate is performed on 0,0)
	                                     1.0f, 1.0f,
	                                     1.0f, 0.0f};
	        model.vertex_colour = new float[] {0.0f, 0.0f, 0.0f, 1.0f,  //RGBA, each vertex of quad
	                                        0.0f, 0.0f, 0.0f, 1.0f,
	                                        0.0f, 0.0f, 0.0f, 1.0f,
	                                        0.0f, 0.0f, 0.0f, 1.0f};
	         model.vertices = new float[] {-0.125f, -0.125f,      //quad vertices; NOTICE: if you start with 0 as bottom left vertex
	                                     0.125f, -0.125f,       // it will spin around this vertex (rotate is performed on 0,0)
	                                     0.125f, 0.125f,
	                                     -0.125f, 0.125f};
	         eCoord.scaleX = 0.25f;
	         eCoord.scaleY = 0.25f;
	         collisionRadius = 0.5f;
	         
	         targetX = target.posX;
	         targetY = target.posY;
	         
	         mod = targetY - eCoord.posY;
	         modx = targetX - eCoord.posX;
		}
		
		public void tick()
		{
			updateMovementByPath();
		}
		
		public void updateMovementByPath()
		{
			eCoord.posX += 0.015f*modx;
			eCoord.posY += (mod)*0.015f;
		}
	}

